/**
 * 依赖包：jquery.min.js
 */
Map = function() {
	this.array = new Array();
	var args = arguments;
	if(args) {
		for(var i=0,length=args.length; i<length; i++) {
			var arg = args[i];
			for(var key in arg) {
				this.array[key] = arg[key];
			}
		}
	}
};
Map.prototype.clearNullAndEmptyValue = function() {
	for(var i in this.array) {
		if(!this.array[i] == null || this.array[i] == '') {
			this.remove(i);
		}
	}
	return this;
};
Map.prototype.append = function() {
	var args = arguments;
	var map = this;
	if(args && args.length > 0) {
		var arg = args[0];
		if(!arg && !arg.size()) {
			//alert("调用Map.append时的传参不是Map或者Map中没有内容");
			return this;
		}
		arg.each(function(k, v){
			map.put(k, v);
		});
	} else {
		//alert("调用Map.append时的传参不是Map或者Map中没有内容");
	}
	return this;
};
Map.prototype.put = function(key, value) {
	this.array[key] = value;
	return this;
};
Map.prototype.get = function(key) {
	return this.array[key];
};
Map.prototype.remove = function(key) {
	var newarr = new Array();
	for(var i in this.array) {
		if(i != key) {
			newarr[i] = this.array[i];
		}
	}
	this.array = newarr;
};
Map.prototype.contains = function(key) {
	for(var i in this.array) {
		if(i == key) return true;
	}
	return false;
};
Map.prototype.each = function(e) {
	for(var i in this.array) {
		e(i, this.array[i]);
	}
};
Map.prototype.size = function() {
	var index = 0;
	for(var i in this.array) {
		index ++;
	}
	return index;
};
Map.prototype.toArray = function() {
	return this.array;
};
Map.prototype.toString = function() {
	var str = "";
	var isFirstTime = true;
	for(var i in this.array) {
		if(isFirstTime) {
			str = str + "\"" + i + "\" : \"" + this.array[i] + "\"";
			isFirstTime = false;
		} else {
			str = str + ", \"" + i + "\" : \"" + this.array[i] + "\"";
		}
	}
	return str;
};
Map.prototype.toJson = function() {
	var jsonStr = "{" + this.toString() + "}"
	eval("var json = " + jsonStr);
	return json;
};
Map.prototype.show = function() {
	alert(this.toString());
};




List = function() {
	this.array = new Array();
	var args = arguments;
	if(args && args.length > 0) {
		var arg = args[0];
		if(!arg.length) {
			//alert("实例List时的传参不是Array或者Array中没有内容");
			return this;
		}
		for(var i=0,length=arg.length; i<length; i++) {
			this.array = this.array.concat(arg[i]);
		}
	}
};
List.prototype.add = function() {
	var args = arguments;
	if(args) {
		for(var i=0,length=args.length; i<length; i++) {
			this.array.push(args[i]);
		}
	}
};
List.prototype.append = function() {
	var args = arguments;
	var list = this;
	if(args && args.length > 0) {
		var arg = args[0];
		if(!arg && !arg.size()) {
			//alert("调用List.append时的传参不是List或者List中没有内容");
			return this;
		}
		arg.each(function(data){
			list.add(data);
		});
	} else {
		//alert("调用List.append时的传参不是List或者List中没有内容");
	}
	return this;
};
List.prototype.appendArray = function() {
	var args = arguments;
	if(args && args.length > 0) {
		var arg = args[0];
		if(!arg.length) {
			//alert("调用List.appendArray时的传参不是Array或者Array中没有内容");
			return this;
		}
		for(var i=0,length=arg.length; i<length; i++) {
			this.array = this.array.concat(arg[i]);
		}
	} else {
		//alert("调用List.appendArray时的传参不是Array或者Array中没有内容");
	}
	return this;
};
List.prototype.get = function(index) {
	return this.array[index];
};
List.prototype.remove = function(value) {
	for(var i=0,length=this.array.length; i<length; i++) {
		if(this.array[i] == value) {
			this.array.splice(i, 1);
		}
	}
};
List.prototype.contains = function(value) {
	for(var i=0,length=this.array.length; i<length; i++) {
		if(this.array[i] == value) {
			return true;
		}
	}
	return false;
};
List.prototype.each = function(e) {
	for(var i=0,length=this.array.length; i<length; i++) {
		e(this.array[i]);
	}
};
List.prototype.size = function() {
	return this.array.length;
};
List.prototype.toArray = function() {
	return this.array;
};
List.prototype.toString = function() {
	return this.array.toString();
};
List.prototype.show = function() {
	alert(this.toString());
};



List.prototype.getTheSamepart = function(compareList) {
	var samePart = new List();
	this.each(function(data){
		if(compareList.contains(data)) {
			samePart.add(data);
		}
	});
	return samePart;
};
List.prototype.getMyUniquePart = function(compareList) {
	var myUniquePart = new List();
	this.each(function(data){
		if(!compareList.contains(data)) {
			myUniquePart.add(data);
		}
	});
	return myUniquePart;
};
List.prototype.getMyLackPart = function(compareList) {
	var myLackPart = new List();
	var me = this;
	compareList.each(function(data){
		if(!me.contains(data)) {
			myLackPart.add(data);
		}
	});
	return myLackPart;
};